package client;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

public class UserInfoFrame extends JFrame implements ActionListener{
	private JLabel Name;
	private JButton ok;
	private JLabel Discount;
	private JLabel Points;
	private JLabel TrueName;
	
	private String name;
	private String discount;
	private String points;
	private String truename;

	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				UserInfoFrame inst = new UserInfoFrame();
				inst.setVisible(true);
			}
		});
	}
	
	public UserInfoFrame() {
		super("User Information");
		initGUI();
		setResizable(false);
		setLocationRelativeTo(null);
		setVisible(true);
	}
	
	private void initGUI() {
		try {
			setLayout(null);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				Name = new JLabel();
				getContentPane().add(Name, BorderLayout.CENTER);
				Name.setText("\u7528\u6237\u540d :"+name);
				Name.setBounds(12, 0, 385, 42);
			}
			{
				TrueName = new JLabel();
				getContentPane().add(TrueName);
				TrueName.setText("\u771f\u5b9e\u59d3\u540d :"+truename);
				TrueName.setBounds(2, 47, 380, 42);
			}
			{
				Points = new JLabel();
				getContentPane().add(Points);
				Points.setText("\u79ef\u5206 :"+points);
				Points.setBounds(25, 92, 333, 40);
			}
			{
				Discount = new JLabel();
				getContentPane().add(Discount);
				Discount.setText("\u6253\u6298\u5361 :"+discount);
				Discount.setBounds(12, 137, 392, 27);
			}
			{
				ok = new JButton();
				getContentPane().add(ok);
				ok.setText("  OK  ");
				ok.setBounds(160, 176, 97, 24);
				ok.addActionListener(this);
			}
			pack();
			this.setSize(410, 235);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if(e.getSource()==ok){
			this.dispose();
		}
		
	}

}
